package cn.zhf.shop.controller;

import cn.zhf.shop.entity.Message;
import cn.zhf.shop.entity.RebateLevel;
import cn.zhf.shop.service.RebateLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = "代理人等级模块")
@RequestMapping("/api/RebateLevel/")
public class RebateLevelController {
    @Resource
    private RebateLevelService rebateLevelService;

    @PostMapping("/")
    @ApiOperation(value = "提交等级")
    public Message insert(RebateLevel rebateLevel){
        return rebateLevelService.insertSelective(rebateLevel);
    }

    @DeleteMapping("/")
    @ApiOperation(value = "删除等级")
    public Message deleteById(int id){
        return rebateLevelService.deleteByPrimaryKey(id);
    }

    @PutMapping("/")
    @ApiOperation(value = "修改等级")
    public Message update(RebateLevel rebateLevel){
        return  rebateLevelService.updateByPrimaryKeySelective(rebateLevel);
    }

    @GetMapping("/one")
    @ApiOperation(value = "根据id查询等级")
    public Message selectById(int Id){
        return rebateLevelService.selectByPrimaryKey(Id);
    }

    @GetMapping("/all")
    @ApiOperation(value = "查看所有等级")
    public Message selectAll(){
        return rebateLevelService.selectAll();
    }
}
